package org.wevil.controller.sys;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wevil.entity.sys.SysAppVersion;
import org.wevil.repo.sys.SysAppVersionRepo;
import org.wevil.util.BeanUtil;
import org.wevil.vo.Result;
import org.wevil.vo.detail.AppVersionDetailVo;

import javax.annotation.Resource;

/** app管理 */
@RestController
@RequestMapping("app")
public class AppController {

    @Resource
    private SysAppVersionRepo repo;

    /** 获取最新APP版本号 */
    @GetMapping("/version")
    public Result<AppVersionDetailVo> version(){
        SysAppVersion entity = repo.findFirst1ByOrderByTsDesc();
        AppVersionDetailVo data = new AppVersionDetailVo();
        BeanUtil.copyPropIgnoreNull(entity, data);
        return Result.success(data);
    }
}
